set nocompatible  "去vi兼容
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'

Plugin 'vim-airline/vim-airline.git' "buffer管理与状态栏
"Plugin 'Valloric/YouCompleteMe' "强大的自动补全，谁用谁知道
Plugin 'sonph/onehalf', {'rtp': 'vim/'}"配色
Plugin 'Mizuchi/STL-Syntax.git'    "STL加入配色
"代码片段
"Plugin 'SirVer/ultisnips'
"Plugin 'honza/vim-snippets'
"快速对齐
Plugin 'godlygeek/tabular.git'
"/自动补全引号 括号等
Plugin 'Raimondi/delimitMate.git'
Plugin 'preservim/nerdtree'    "/ctags标签提取显示
Plugin 'yegappan/taglist'   "/文件树浏览
Plugin 'majutsushi/tagbar'
Plugin 'terryma/vim-expand-region'  "/自动选择括号等符号中的内容
Plugin 'scrooloose/nerdcommenter'   "一键注释
Plugin 'nathanaelkane/vim-indent-guides'    "分层色块
Plugin 'bronson/vim-trailing-whitespace'    "/显示以及去除行尾空格
"Plugin 'terryma/vim-multiple-cursors'  "/多光标同时编辑
"Plugin 'tpope/vim-haml'    "/sass scss haml等css开发语言支持
"Plugin 'genoma/vim-less'   "/less支持
"Plugin 'docunext/closetag.vim' "/html xml自动闭合标签
"Plugin 'gregsexton/MatchTag'   "/自动高亮匹配标签
"Plugin 'easymotion/vim-easymotion' "/强大的搜索定位
"Plugin 'tpope/vim-surround'    "/符号自动环绕
"Plugin 'tpope/vim-repeat'  "/更为强大的重做功能
"Plugin 'rstacruz/vim-ultisnips-css'    "/css的补全
"Plugin 'tacahiroy/ctrlp-funky' "/基于ctrlp的搜索函数等变量名
"Plugin 'dyng/ctrlsf.vim'   "/基于ctrlp的文件内容搜索，配合vim－multiple－cursors可以很方便一次修改多个文件的内容
"Plugin 'pangloss/vim-javascript'   "/更好的js语法 锁进支持
"Plugin 'othree/yajs.vim'   "/更好的js语法高亮
"Plugin 'othree/javascript-libraries-syntax.vim'    "/js各类框架 库的高亮支持
"Plugin 'maksimr/vim-jsbeautify'    "/格式化js css等
"Plugin 'marijnh/tern_for_vim'  "/牛逼的基于语法分析的补全
"Plugin 'mbriggs/mark.vim'  "/标记高亮
"Plugin 'gorodinskiy/vim-coloresque'    "/颜色符号显示对应颜色
"Plugin 'Xuyuanp/nerdtree-git-plugin'   "/git支持
"Plugin 'scrooloose/syntastic'  "语法检查
"Plugin 'davidhalter/jedi'  "python补全插件
"Plugin 'JavaScript-Indent' "BUF管理
"Plugin 'vimplugin/project.vim' "目录树

call vundle#end()
filetype plugin indent on

let &termencoding=&encoding "中文支持
set fileencodings=ucs-bom,utf-8,gbk
"set mouse=a    "启用鼠标
syntax on   "语法高亮
colorscheme onehalflight
let g:airline_theme='onehalfdark'

if (&term=="xterm" || &term=="screen-256color")
    set t_Co=256
    set t_Sb=[4%dm
    set t_Sf=[3%dm
else
    set t_Co=256
endif
set number  "行号显示
set go= "无菜单栏及工具栏
set backspace=indent,eol,start whichwrap+=<,>,[,] "解决BackSpace无效

" 不要生成swap文件，当buffer被丢弃的时候隐藏它
setlocal noswapfile
set bufhidden=hide

"热键配置
let mapleader=","
map <Leader>e <End>
map! <Leader>e <End>
imap <Leader>w <Esc> wi
imap <Leader>b <Esc> bi
nmap <Leader>t :call NERDTreeAndTagbar()<CR>
nmap <Leader>n :w<CR>:bn<CR>
nmap <Leader>p :w<CR>:bp<CR>
imap <Leader>l <Right>
imap <Leader>k <Up>
imap <Leader>j <Down>
imap <Leader>h <Left>
imap <Leader>u <Esc>u
nmap <Leader>s :w<CR>
imap <Leader>s <Esc>:w<CR>i<Right>
map <C-4> :qa!<CR>
map! <C-4> <Esc>:qa!<CR>
"注释反注释热键
vmap <Leader>i :Tabularize/
map <Leader>1 :wincmd b<CR>
map! <Leader>1 <Esc>:wincmd b<CR>

set showcmd
set incsearch                                   " 开启实时搜索功能
set ignorecase                                  " 搜索时大小写不敏感
set wildmenu 				                	" vim 自身命令行模式智能补全
set laststatus=2 	    		            	" 总是显示状态栏
set hlsearch 			    	            	"高亮搜索结果
set shiftwidth=4	    		            	"格式化时制表符占用空格数
set expandtab			    	    	        "将制表符扩展为空格
set tabstop=4				         	        "制表符点用空格数
set softtabstop=4			        	        "连续数量空格视为制表符
set nohlsearch                                     "禁止折行
set cursorline  "高亮显示当前行/列
set cursorcolumn    "显示光标当前位置
set ruler
"set rulerformat=(%2*%

"ultisnips
let g:UltiSnipsExpandTrigger="<Leader>a"
let g:UltiSnipsJumpForwardTrigger="<Tab>"  "可以自行配置，比如我的<,-l>，作用是跳到下一个占位符
let g:UltiSnipsJumpBackwardTrigger="<S-Tab>"
"  "我的<c-h>，上一个占位符

"indent_guides
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_start_level=2 "从第二层开始可视化显示缩进
let g:indent_guides_guide_size=1  "色块宽度
let g:indent_guides_auto_colors=1

"NREDTree&&Tagbar
let NERDTreeShowHidden=1
let g:tagbar_vertical = 30
let g:NERDTreeAndTagbar_IsOpen = 0
function! NERDTreeAndTagbar()
    if(g:NERDTreeAndTagbar_IsOpen == 0)
        let g:NERDTreeAndTagbar_IsOpen = 1
        exec 'NERDTree|TagbarOpen'
        exec 'winc b'
    else
        let g:NERDTreeAndTagbar_IsOpen = 0
        exec 'NERDTreeClose|TagbarClose'
    endif
endfunction

"按,F2 会跳转到定义
let g:syntastic_always_populate_loc_list = 1
set completeopt=longest,menu
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
inoremap <expr> <CR>       pumvisible() ? "\<C-y>" : "\<CR>"
inoremap <expr> <Tab>     pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab>    pumvisible() ? "\<C-p>" : "\<S-Tab>"
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
" 关闭状态显示空白符号计数,这个对我用处不大"
"let g:airline#extensions#whitespace#enabled = 0
"let g:airline#extensions#whitespace#symbol = '!'

